cmake_minimum_required(VERSION 2.8)
PROJECT (RSYNCSERVER)
SET(SRC_LIST main.cpp conf.cpp dictionary.cpp iniparser.cpp log.cpp util.cpp sync.cpp thread_pool.cpp)
#MESSAGE(STATUS "This is BINARY dir " ${RSYNCSERVER_BINARY_DIR})
#MESSAGE(STATUS "This is SOURCE dir " ${RSYNCSERVER_SOURCE_DIR})
ADD_DEFINITIONS(-g -Wall)

INCLUDE_DIRECTORIES(/usr/local/include)
FIND_LIBRARY(JEMALLOC_LIBRARY NAMES jemalloc
             PATHS /usr/local/lib )
FIND_LIBRARY(ZLOG_LIBRARY NAMES zlog
             PATHS /usr/local/lib )
FIND_LIBRARY(HIREDIS_LIBRARY NAMES hiredis
             PATHS /usr/local/lib )
             
ADD_EXECUTABLE(redis_sync_server ${SRC_LIST})

TARGET_LINK_LIBRARIES(redis_sync_server ${JEMALLOC_LIBRARY} ${ZLOG_LIBRARY} ${HIREDIS_LIBRARY})

INSTALL(
    TARGETS redis_sync_server DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
INSTALL(
    DIRECTORY etc DESTINATION ${CMAKE_INSTALL_PREFIX}
)